package com.yuan.fishing_fun

import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.WindowManager
import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        // 设置透明导航栏
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            window.apply {
                // 启用绘制系统栏背景
                addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
                // 清除半透明状态栏标志
                clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
                // 清除半透明导航栏标志
                clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
                // 设置状态栏透明
                statusBarColor = android.graphics.Color.TRANSPARENT
                // 设置导航栏透明
                navigationBarColor = android.graphics.Color.TRANSPARENT
                
                // Android 8.0+ 设置导航栏图标为深色
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                    decorView.systemUiVisibility = decorView.systemUiVisibility or 
                        View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
                }
                
                // Android 10+ 禁用导航栏对比度强制
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
                    isNavigationBarContrastEnforced = false
                }
            }
        }
    }
}
